Ext.define('TS.view.inv.InventorySimpleList' ,{
    extend: 'Ext.grid.Panel',
    alias : 'widget.inventorysimplelist',
    title : '商品存货',
    columnLines: true,
    bodyPadding:0,
    frame : true,//面板渲染
    closable: true,
    columns:[
    		{header: '库房',width:60,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.inventoryAdd))
            			return '';
					return record.raw.inventoryAdd.inventoryAddName;
				}
			},
            {header: '商品编号',width:80,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.product))
            			return '';
					return record.raw.product.productCode;
				}
			},
			{header: '商品名称',width:200,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.product))
            			return '';
					return record.raw.product.productName;
				}
			},
			{header: '规格',width:80,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.product))
            			return '';
					return record.raw.product.packSpec;
				}
			},
			{header: '生产企业',width:100,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.product))
            			return '';
					return record.raw.product.manuf;
				}
			},
			{header: '单位',width:40,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.product))
            			return '';
					return record.raw.product.unit;
				}
			},
            {header: '批号',width:80,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.batchNo))
            			return '';
					return record.raw.batchNo.batchNo;
				}
			},
            {header: '可用库存', dataIndex: 'usableQty',width:80},
            {header: '库存数量', dataIndex: 'remainQty',width:80},
            {header: '状态', dataIndex: 'state',width:50,
            	renderer:function(value,metaData,record){
            		if(value==0)
            			return '可用'
            		else
            			return '不可用'
            	}
            },
			{header: '生产日期',width:80,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.batchNo))
            			return '';
					return record.raw.batchNo.manufDate;
				}
			},
			{header: '有效期',width:80,
            	renderer:function(value,metaData,record){
					if(Ext.isEmpty(record.raw.batchNo))
            			return '';
					return record.raw.batchNo.expDate;
				}
			}
    ],
	selType:'checkboxmodel',//设定选择模式
	multiSelect:true,//运行多选
	initComponent:function(){
		var st=Ext.create('TS.store.inv.InventoryStore');
		this.store=st;
		this.dockedItems =[{
				xtype:'pagingtoolbar',
				store:st,
				dock:'bottom',
				displayInfo:true
		}],
		this.callParent(arguments);
	}
});
